package com.tcxhb.job.core.schedule.handler.impl;

import com.tcxhb.job.common.constants.JobTypeConstants;
import com.tcxhb.job.core.schedule.handler.JobHandler;
import com.tcxhb.job.dao.dataobject.JobInstanceDO;
import com.tcxhb.job.core.constants.JobHandlerMapping;
import com.tcxhb.job.core.service.job.AgentApiService;
import com.tcxhb.job.common.model.MiscResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description: 需要在和客户端执行的handler
 * @Auther: tcxhb
 * @Date: 2023/11/5
 */
@Component
@JobHandlerMapping(name = JobTypeConstants.JAVA_BEAN, desc = "javaBean处理逻辑")
public class JavaBeanHandler implements JobHandler {
    @Autowired
    private AgentApiService agentApiService;

    @Override
    public MiscResult<Boolean> handle(JobInstanceDO instanceDO) {
        return agentApiService.run(instanceDO);
    }
}
